package org.firebug.spring.boot.activemq.config;

import org.springframework.boot.autoconfigure.jms.JmsPoolConnectionFactoryFactory;
import org.springframework.boot.autoconfigure.jms.JmsPoolConnectionFactoryProperties;
import org.springframework.context.annotation.Bean;

//@Configuration
//@EnableConfigurationProperties(JmsPoolConnectionFactoryProperties.class)
public class ActivemqConfig {
//    @Autowired
    private JmsPoolConnectionFactoryProperties properties;


    @Bean
    public JmsPoolConnectionFactoryFactory jmsPoolConnectionFactoryFactory() {
        return new JmsPoolConnectionFactoryFactory(properties);
//        JmsPoolConnectionFactory f = factory.createPooledConnectionFactory(null);
    }

//    @Bean
//    public PooledConnectionFactory pooledConnectionFactory() {
//        PooledConnectionFactory factory = new PooledConnectionFactory();
//        factory.setMaxConnections(activemqProperties.getMaxConnections());
//        factory.setMaximumActiveSessionPerConnection(activemqProperties.getMaxSessionsPerConnection());
//        factory.setIdleTimeout((int) activemqProperties.getIdleTimeout().getSeconds());
//        factory.setBlockIfSessionPoolIsFull(activemqProperties.isBlockIfFull());
//        factory.setBlockIfSessionPoolIsFullTimeout(activemqProperties.getBlockIfFullTimeout());
//        factory.setTimeBetweenExpirationCheckMillis(activemqProperties.getTimeBetweenExpirationCheck());
//        factory.setUseAnonymousProducers(activemqProperties.isUseAnonymousProducers());
//        factory.setExpiryTimeout(0L);
//        factory.setCreateConnectionOnStartup(true);
//        factory.setReconnectOnException(false);
//        return factory;
//    }
}
